#ifndef __TERRAINHELPEROBJECT_H__
#define __TERRAINHELPEROBJECT_H__

#include <bigimage/renderitem.h>
#include <bigimage/geometry.h>
#include "helper/helperobject.h"

class CTerrainObject;
class CTerrainHelperGridGeometry: public CRefObject{
public:
	CTerrainHelperGridGeometry(CTerrainObject* pTerrainObject);
	virtual ~CTerrainHelperGridGeometry();
	virtual void InitGeometry( CRenderItem* pRenderItem );
	virtual void UpdateGeometry();
	
protected:
	CTerrainObject* m_pTerrainObject;
	Ref < CVertexBuffer* > m_rRenderBuffer;
	Ref< CIndexBuffer* >m_rIndexBuffer;
};

class CTerrainHelperGridType0Geometry :public CTerrainHelperGridGeometry {
public:
	CTerrainHelperGridType0Geometry(CTerrainObject* pTerrainObject);
	virtual ~CTerrainHelperGridType0Geometry();
	virtual void InitGeometry( CRenderItem* pRenderItem );
	virtual void UpdateGeometry();
};

class CTerrainHelperGridType1Geometry :public CTerrainHelperGridGeometry {
public:
	CTerrainHelperGridType1Geometry(CTerrainObject* pTerrainObject);
	virtual ~CTerrainHelperGridType1Geometry();
	virtual void InitGeometry( CRenderItem* pRenderItem );
	virtual void UpdateGeometry();
};
////
////class CTerrainHelperGridType2Geometry :public CTerrainHelperGridGeometry {
////public:
////	CTerrainHelperGridType2Geometry(CTerrainObject* pTerrainObject);
////	virtual ~CTerrainHelperGridType2Geometry();
////	virtual void UpdateGeometry();
////};

class CTerrainGridHelperObject: public CHelperObject {
public:
	CTerrainGridHelperObject();
	virtual ~CTerrainGridHelperObject();
	void Init(CTerrainObject* pTerrainObject, int32 nShowMode );
	void UpdateGeometry();
	virtual int32 GetRenderElementHandles(CRenderElement** vRenderElementHandle, int32 nMaxCount);
	int32 GetGeometryMode() { return m_nGeometryMode;  }

private:
	int32 m_nGeometryMode;
	CTerrainObject* m_pTerrainObject;
	Ref< CRenderItem* >m_rRenderItem;
	Ref< CTerrainHelperGridGeometry* >m_rTerrainHelperGeometry;
};



#endif
